php forum
php mysql forum
php mysql smarty
 
Page 1 of 3 1 2 3 >
Topic Options
#310935 - 07/30/06 03:36 AM [7.0] [Beta] PhotoPost featured photos pal
Zarzal Offline
Coder

Registered: 07/03/01
Posts: 811
Loc: Berlin, Germany
This code is for the pal boxes in Threads7 (beta1). It pull 5 pictures (default random) from the PhotoPost database and display them in pal box.

You need to set the database names according to your setup. The script switch the database to make selects from the PhotoPost db and then switch back to Threads database. You need set the cache time (I use 5 minutes) and always build off ind the Threads7 control panel.

This script works without a PhotoPost Threads7 integration. It just take the pictures from the db.

The original is from Omegatron/Chuck S. for Threads 6.5x

Php Code:
// This script should pull 5 random pictures from
// PhotoPost and display it.
// Please modify the two lines with the databse
// connection to your settings.
//
// The base idea for this script comes from Chuck S. */

// Set it up to your path settings !
require_once("/home/..../ubbthreads/photopost.inc.php");

// Set this to your PhotoPost db prefix. Default is pp_
$pp_db_prefix = "pp_";

function pp_get_ext( $filename ) {
return substr($filename, strrpos($filename,"."));
}

function pp_is_image( $filename ) {
$retval = 0;

$mediatypes = array( ".jpg", ".gif", ".png", ".bmp" );
$ext = pp_get_ext( $filename );

if ( in_array(strtolower($ext), $mediatypes) )
$retval = 1;

return( $retval );
}

//
// Featured Photos Code
// Follow down to End Feature Photos Code
//

// which type of images do you want to show
$q_switch = "random";

switch ($q_switch) {
case "most_view":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY c.views DESC";
break;
case "lastest":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY date DESC";
break;
case "random":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY RAND()";
break;
}
$result = mysql_query($query);

$counted = 0; $featured = "";

while ( list($pid, $puser, $puserid, $pcat, $ptitle, $photo, $pviews) = mysql_fetch_array($result)) {
if ( pp_is_image($photo) ) {
$photolen = strlen($photo);
$theext = pp_get_ext($photo);
$photo_name = str_replace( $theext, "", $photo );

$temp_user = $line['userid'];
$thumbtag = "{$full_path}{$pcat}/thumbs/{$photo}";
$mthumb = "<img border=\"0\" src=\"{$data_dir}{$pcat}/thumbs/{$photo}\" alt=\"$thumbtag\" />";

// One box for each feature
$featured .= <<<PPPRINT

<tr align="center"><td align="center" class="alt-1">
<a href="{$url_path}showphoto.php?photo={$pid}">$mthumb</a>

by {$puser}
</td></tr>

PPPRINT;

$counted++;
}

if ( $counted == 5 ) break;
}
mysql_free_result($result);

// change the dbname to your ubb7 database name
// we need to switch back to Threads7 database
mysql_select_db ("dbname")or die("Could not select database");

$body = <<<PPPRINT
$featured
PPPRINT; 

_________________________
my forum: http://www.dragon-clan.de
my hobby: http://www.biker-reise.de

Top
#310967 - 07/31/06 11:11 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: Zarzal]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
Thanks smile You have photopost working with threads 7?
_________________________
- Allen wavey
- What Drives You?

Top
#310973 - 07/31/06 03:48 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: AllenAyres]
Zarzal Offline
Coder

Registered: 07/03/01
Posts: 811
Loc: Berlin, Germany
no, right now I run ubb6.5.5 with pp 5.31 and just pull the featured photos to ubb7beta1 for testing. This work without integration. I open a thread on PP support for the integration. It must be total rewritten. The database structure ist very different from ubb6.5 to ubb7. The ol PP integration can take nearly everything from the huge users table in ubb6.5 but in v7 this table is split in 5 tables. I start some tries but give up.

I compare some differents an Chuck say they need first a license for ubb7 to look in to it.
_________________________
my forum: http://www.dragon-clan.de
my hobby: http://www.biker-reise.de

Top
#311092 - 08/05/06 02:09 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: Zarzal]
StanCA Offline
Power User

Registered: 07/01/02
Posts: 71
Ok so where does this code go?

My testing site for version 7 is not in the same folder as the photopost and my main forum... can that still work?


Eager to see this and THANKS
_________________________
www.clubadventist.com

Top
#311098 - 08/05/06 05:20 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: StanCA]
Zarzal Offline
Coder

Registered: 07/03/01
Posts: 811
Loc: Berlin, Germany
This box code works with every installed PhotoPost somewhere. The only thing you need is access to the photopost.inc.php
The script connects to the Photopost database throught this file. Then select the photos and build the output. If this finished the script switch back the database connection to threads.
Thats why you have to edit the both database connetions in this script matching your settings.

Its pretty simple. No integration is needet. I run Photopost with a threads V6.5 integration on my production V6.5.5 Threads board. I setup on a other webpage threads V7 for testing and pull from the PP the pictures, works very well.

Just test it - its easy and should work on your system too.

An other point is a threads V7 integration and the pppanel script hack. I look forward into this. The integration must done by PP, thats complex but I will take a closer look to the pppanel script. Maybe I bring this to work.
_________________________
my forum: http://www.dragon-clan.de
my hobby: http://www.biker-reise.de

Top
#311620 - 10/07/06 01:27 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: Zarzal]
StanCA Offline
Power User

Registered: 07/01/02
Posts: 71

I am committed to get the 5 randoms photo up this weekend

Quote:
Parse error: parse error, unexpected $ in /homepages/1/d118328893/htdocs/clubadventist/forum/cache_builders/custom/portal_box_10.php on line 108


this is in one of the custom islands

Stan

By the way, Chuck has done the code to tie it version 7.
_________________________
www.clubadventist.com

Top
#311621 - 10/07/06 01:27 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: StanCA]
StanCA Offline
Power User

Registered: 07/01/02
Posts: 71
as far as I can count there are not 108 lines...
_________________________
www.clubadventist.com

Top
#311622 - 10/07/06 01:28 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: StanCA]
StanCA Offline
Power User

Registered: 07/01/02
Posts: 71
Here is the whole code
Quote:
//* PHP CODE HERE */
// This script should pull 5 random pictures from
// PhotoPost and display it.
// Please modify the two lines with the databse
// connection to your settings.
//
// The base idea for this script comes from Chuck S. */

// Set it up to your path settings !
require_once("/homepages/1/d118328893/htdocs/clubadventist/photopost/index.php");

// Set this to your PhotoPost db prefix. Default is pp_
$pp_db_prefix = "pp_";

function pp_get_ext( $filename ) {
return substr($filename, strrpos($filename,"."));
}

function pp_is_image( $filename ) {
$retval = 0;

$mediatypes = array( ".jpg", ".gif", ".png", ".bmp" );
$ext = pp_get_ext( $filename );

if ( in_array(strtolower($ext), $mediatypes) )
$retval = 1;

return( $retval );
}

//
// Featured Photos Code
// Follow down to End Feature Photos Code
//

// which type of images do you want to show
$q_switch = "random";

switch ($q_switch) {
case "most_view":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY c.views DESC";
break;
case "lastest":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY date DESC";
break;
case "random":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY RAND()";
break;
}
$result = mysql_query($query);

$counted = 0; $featured = "";

while ( list($pid, $puser, $puserid, $pcat, $ptitle, $photo, $pviews) = mysql_fetch_array($result)) {
if ( pp_is_image($photo) ) {
$photolen = strlen($photo);
$theext = pp_get_ext($photo);
$photo_name = str_replace( $theext, "", $photo );

$temp_user = $line['userid'];
$thumbtag = "{$full_path}{$pcat}/thumbs/{$photo}";
$mthumb = "<img border=\"0\" src=\"{$data_dir}{$pcat}/thumbs/{$photo}\" alt=\"$thumbtag\" />";

// One box for each feature
$featured .= <<<PPPRINT

<tr align="center"><td align="center" class="alt-1">
<a href="{$url_path}showphoto.php?photo={$pid}">$mthumb</a>
<br />by {$puser}
</td></tr>

PPPRINT;

$counted++;
}

if ( $counted == 5 ) break;
}
mysql_free_result($result);

// change the dbname to your ubb7 database name
// we need to switch back to Threads7 database
mysql_select_db ("db177660228")or die("Could not select database");

$body = <<<PPPRINT
$featured
PPPRINT;
/* BODY HERE */
$body = <<<EOF
EOF;



_________________________
www.clubadventist.com

Top
#311632 - 10/09/06 05:57 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: StanCA]
Zarzal Offline
Coder

Registered: 07/03/01
Posts: 811
Loc: Berlin, Germany
the problem is simple to solve:
Php Code:
require_once("/homepages/1/d118328893/htdocs/clubadventist/photopost/index.php"); 

is wrong. Change it to:

Php Code:
require_once("/your path here to/photopost.inc.php"); 


_________________________
my forum: http://www.dragon-clan.de
my hobby: http://www.biker-reise.de

Top
#311647 - 10/10/06 03:46 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: Zarzal]
StanCA Offline
Power User

Registered: 07/01/02
Posts: 71
I am not the fluent in php, or pretty much anything these dasy (ask my kids smile )

How far back does that path go??

should it be

/homepages/1/d118328893/htdocs/clubadventist/photopost.inc.php

or /clubadventist/photopost.inc.php?

Can not get either one to work

I copy and paste the db name from my control panel in my forums, in the end line..

Yet it comes back and says db not found "Could not select database" which comes from the end of the php code..

photopost in ins
/clubadventist/photopost/

I would have thought photopost.inc.php would have been in the /photopost/ folder.

there is a 'inc_photopost.php' in the photopost folder....

Am using photopost 5.5

Thanks for your kind patience...

Stan
_________________________
www.clubadventist.com

Top
#311648 - 10/10/06 04:27 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: StanCA]
Micky Offline
Member

Registered: 02/11/04
Posts: 184
Loc: Bern, Switzerland
Originally Posted By: StanCA
I would have thought photopost.inc.php would have been in the /photopost/ folder.

there is a 'inc_photopost.php' in the photopost folder....

Hi Stan,
do you have photopost.inc.php in your forum list? If I have the file with upload, list must be adapted only to your photopost. Then you can put the link to photopost.inc.php.
I send photopost.inc.php as a photopost.txt file, am not able to do but I them uploads... Must change the ending .txt in .inc.php.


Attachments
2272-photopost.txt (88 downloads)

_________________________
Gruss Micky

Golf Diesel Forum

Top
#312439 - 12/31/06 01:28 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: Micky]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
Does the photopost.inc.php file go in the includes folder or the scripts folder? smile
_________________________
- Allen wavey
- What Drives You?

Top
#312440 - 12/31/06 01:40 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: AllenAyres]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
This line looks a little buggy:

FROM {$pp_db_prefix}photos p
_________________________
- Allen wavey
- What Drives You?

Top
#312449 - 01/01/07 09:44 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: AllenAyres]
Zarzal Offline
Coder

Registered: 07/03/01
Posts: 811
Loc: Berlin, Germany
yes, looks strange but work smile I look in the very old pal box for threads 6 and there are the same syntax. I dont have any clue how this work.
_________________________
my forum: http://www.dragon-clan.de
my hobby: http://www.biker-reise.de

Top
#312461 - 01/02/07 12:25 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: Zarzal]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
The current code in inc.features.php is a little different than what's posted here, tho I still can't get it to work smash
_________________________
- Allen wavey
- What Drives You?

Top
#312465 - 01/02/07 02:01 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: AllenAyres]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
OK, found the current way of getting this to work.
  1. Take the inc.features.php file in photopost and re-name it to inc.features2.php
  2. uncomment lines 25 and 26, filling out your photopost database info
  3. edit line #32 to 1 (so it displays one column vertically in your sidebar)
  4. remove this (starting at line # 146)
    Php Code:
    
    	if ( $ViewPerm[$pcat] == 1 )
    	{
    		continue;
    	}
     
    
  5. uncomment line #238 (#235 after you remove the above smile ) and fill out your threads database info
  6. remove this section (to keep from having 2 titles for the custom island):
    Code:
        <thead>
        <tr>
        <td class="tcat" colspan="$columns" align="center">
            <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('featurepal');"><img id="collapseimg_featurepal" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_featurepal].gif" alt="" border="0" /></a>
            Featured Photos
        </td>
        </tr>
        </thead>
    
  7. upload to your photopost directory
  8. add this code to your custom portal island box (updating the path at the top)
    Code:
    /* PHP CODE HERE */
    include('/var/yourpathto/gallery/inc_features2.php');
    
    /* BODY HERE */
    $body = <<<EOF
    $photopostfeature
    EOF;
    


voila! It should be working smile I see them fine in mozilla, but not in IE smash
http://www.praisecafe.org/forum/ubbthreads.php/ubb/cfrm
_________________________
- Allen wavey
- What Drives You?

Top
#312467 - 01/02/07 02:47 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: AllenAyres]
Z65_Paul Offline
Lurker

Registered: 09/12/06
Posts: 6
Allen.. I confim they aren't showing up on your site using I.E. here too.

I got Zarzal's code to work on my site (UBB.t V7.0.2 & PP V5.6.2) by removing the code at the bottom that asks for the ubb database:

Code:
mysql_select_db ("dbname")or die("Could not select database");


So the end of my content island code looks like this:
Code:
PPPRINT;

$counted++;
}

if ( $counted == 5 ) break;
}
mysql_free_result($result);


/* DO NOT CHANGE THE LINE BELOW */

$body = <<<PPPRINT

$featured

PPPRINT;

EOF;
/* DO NOT CHANGE THE LINE ABOVE */


Also note the spelling error in the script "lastest" should be "latest". In addition to the default "random", "latest" works, but "most_view" does not. I haven't played with it to determine why.

I also had to uploaded and modify the text file Zarzal posted earlier in the thread, and saved it in the PP directory as photopost.inc.php. This appears to be a file that was present in an earlier version of PP, but is not present in the latest download. inc-photopost.php appears to have much of the same code as Zaral's script.. but I was not able to figure out a way to make it work (with my very limited PHP skills).

And lastly, I set the cache to '3' on the content island to have it rebuild the random set of images every 3 minutes.

Anyway, the result is a pretty clean sidebar box which only shows the user name under each image. (your implementation has a link to the user's gallery, how many images they have and how many comments). Have a look on my site to see the result.

The only other buggy behavior I've found (and haven't yet figured it out) is the sidebar sometimes pulls random images from categories that only have copied images in them (admin copied to a feature category). In those cases, there is no thumbail in the category to pull.. so a red-X appears. Not sure if this is an issue with PP or the PAL script. You won't run into the problem unless you've set up some Admin/Mod only categories in PP (or other similar categories) that only have images that are copied into them from other categories. My "SS Exhibit" category is an example of this.

Let me know if you need more info.

Oh.. and thanks Zarzal!
_________________________
UBB since 1999: MonteCarloSS.com

Top
#312471 - 01/02/07 08:38 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: Z65_Paul]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
I edited the file to fix the images smile I kinda like the extra info now, tho I may go to a simpler layout in the future smile

http://www.praisecafe.org/forum/ubbthreads.php/ubb/cfrm
_________________________
- Allen wavey
- What Drives You?

Top
#313266 - 02/25/07 11:44 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: AllenAyres]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 135
Loc: New Mexico
I have tried this mod running Threads 7.1Beta5 and Photopost 5.62 (integrated) and when I plug in the code provided I get this error:

Parse error: syntax error, unexpected $end in /home/xxx/public_html/forums/cache_builders/custom/portal_box_9.php on line 104

I basically plugged in the "complete" code that stanCA has in his post above. What am I doing wrong?

Basil
_________________________

Top
#313268 - 02/25/07 02:37 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: Basil Fawlty]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 135
Loc: New Mexico
Here is everything I have in my custom portal box:

Php Code:

/* PHP CODE HERE, IF NECESSARY */
// This script should pull 5 random pictures from
// PhotoPost and display it.
// Please modify the two lines with the databse
// connection to your settings.
//
// The base idea for this script comes from Chuck S. */

// Set it up to your path settings !
require_once("/home/mysite/public_html/bcforum/includes/photopost.inc.php");

// Set this to your PhotoPost db prefix. Default is pp_
$pp_db_prefix = "pp_";

function pp_get_ext( $filename ) {
return substr($filename, strrpos($filename,"."));
}

function pp_is_image( $filename ) {
$retval = 0;

$mediatypes = array( ".jpg", ".gif", ".png", ".bmp" );
$ext = pp_get_ext( $filename );

if ( in_array(strtolower($ext), $mediatypes) )
$retval = 1;

return( $retval );
}

//
// Featured Photos Code
// Follow down to End Feature Photos Code
//

// which type of images do you want to show
$q_switch = "random";

switch ($q_switch) {
case "most_view":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY c.views DESC";
break;
case "lastest":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY date DESC";
break;
case "random":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY RAND()";
break;
}
$result = mysql_query($query);

$counted = 0; $featured = "";

while ( list($pid, $puser, $puserid, $pcat, $ptitle, $photo, $pviews) = mysql_fetch_array($result)) {
if ( pp_is_image($photo) ) {
$photolen = strlen($photo);
$theext = pp_get_ext($photo);
$photo_name = str_replace( $theext, "", $photo );

$temp_user = $line['userid'];
$thumbtag = "{$full_path}{$pcat}/thumbs/{$photo}";
$mthumb = "<img border=\"0\" src=\"{$data_dir}{$pcat}/thumbs/{$photo}\" alt=\"$thumbtag\" />";

// One box for each feature
$featured .= <<<PPPRINT

<tr align="center"><td align="center" class="alt-1">
<a href="{$url_path}showphoto.php?photo={$pid}">$mthumb</a>

by {$puser}
</td></tr>

PPPRINT;

$counted++;
}

if ( $counted == 5 ) break;
}
mysql_free_result($result);

// change the dbname to your ubb7 database name
// we need to switch back to Threads7 database
mysql_select_db ("MyDBNAME IS HERE")or die("Could not select database");

$body = <<<PPPRINT
$featured
PPPRINT; 

/* DO NOT CHANGE THE LINE BELOW */
$body = <<<EOF

Body of the custom box here

EOF;
/* DO NOT CHANGE THE LINE ABOVE */

  


When I try to save it, I get unxepected $END at line...blah blah (see previos post).


Edited by Basil Fawlty (02/25/07 02:38 PM)
_________________________

Top
#313277 - 02/26/07 01:50 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: Basil Fawlty]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 135
Loc: New Mexico
UPDATE - I managed to get rid of the Parse Error (I think it was an extra space after the EOF; but not the thing still does not pull in picture to my Portal. Zarzal - you mentioned over on UBBCENTRAL that you were runnning this with Threads 7.1 - is your photopost integrated with your threads or not? I did download the photopost.inc.php file you provided and point to it ini the script file, but th eprotal has nothing in it when I display it.
_________________________

Top
#313280 - 02/26/07 08:45 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: Basil Fawlty]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
Can you post a link to the page throwing the error?
_________________________
- Allen wavey
- What Drives You?

Top
#313281 - 02/26/07 08:58 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: AllenAyres]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 135
Loc: New Mexico
Originally Posted By: AllenAyres
Can you post a link to the page throwing the error?


Hi Allen! Well, to be honest, I seem to have fixed that particular error (I think it was an extra space after the EOF;) Anyway, that's the good news. The bad news is, When I put that custom Pal on my portal, the box shows up with only the title header but nothing in it. Here is what I currently have in that Custom Pal Box:

Php Code:

/* PHP CODE HERE */
// This script should pull 5 random pictures from
// PhotoPost and display it.
// Please modify the two lines with the databse
// connection to your settings.
//
// The base idea for this script comes from Chuck S. */

// Set it up to your path settings !
require_once("/home/mysite/public_html/forum/photopost/photopost.inc.php");

// Set this to your PhotoPost db prefix. Default is pp_
$pp_db_prefix = "pp_";

function pp_get_ext( $filename ) {
return substr($filename, strrpos($filename,"."));
}

function pp_is_image( $filename ) {
$retval = 0;

$mediatypes = array( ".jpg", ".gif", ".png", ".bmp" );
$ext = pp_get_ext( $filename );

if ( in_array(strtolower($ext), $mediatypes) )
$retval = 1;

return( $retval );
}

//
// Featured Photos Code
// Follow down to End Feature Photos Code
//

// which type of images do you want to show
$q_switch = "random";

switch ($q_switch) {
case "most_view":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY c.views DESC";
break;
case "lastest":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY date DESC";
break;
case "random":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY RAND()";
break;
}
$result = mysql_query($query);

$counted = 0; $featured = "";

while ( list($pid, $puser, $puserid, $pcat, $ptitle, $photo, $pviews) = mysql_fetch_array($result)) {
if ( pp_is_image($photo) ) {
$photolen = strlen($photo);
$theext = pp_get_ext($photo);
$photo_name = str_replace( $theext, "", $photo );

$temp_user = $line['userid'];
$thumbtag = "{$full_path}{$pcat}/thumbs/{$photo}";
$mthumb = "<img border=\"0\" src=\"{$data_dir}{$pcat}/thumbs/{$photo}\" alt=\"$thumbtag\" />";

// One box for each feature
$featured .= <<<PPPRINT

<tr align="center"><td align="center" class="alt-1">
<a href="{$url_path}showphoto.php?photo={$pid}">$mthumb</a>

by {$puser}
</td></tr>

PPPRINT;

$counted++;
}

if ( $counted == 5 ) break;
}
mysql_free_result($result);

// change the dbname to your ubb7 database name
// we need to switch back to Threads7 database
mysql_select_db ("threadsv7")or die("Could not select database");

$body = <<<PPPRINT
$featured
PPPRINT;
/* BODY HERE */
$body = <<<EOF
EOF;

 



I'm using the photopost.inc.php file that Zarzal (I think) posted as a text file and edited to point to my photopost DB. I guess its working since I'm not getting an error that it can't connect to the DB.

I am not getting any error, but all I get when I place the pal on the Portals page is the header and the box itself is empty.

I'm running Threads 7.1(Beta 5) and Photopost 5.62 and its running in the "integrated" mode with my Threads.

Any ideas?

Thanks,
Basil


Edited by Basil Fawlty (02/26/07 09:00 AM)
_________________________

Top
#313283 - 02/26/07 09:25 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: Basil Fawlty]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
Well, it *was* working on my site, now it's not. smash I think I overwrote my custom islands when I upgraded.

I'll have to figure it out, but basically from what I can see on your code you don't have anything displaying because you don't have anything between the:

$body = <<<EOF
content should be here
EOF;

You'll get blank content islands everytime.
_________________________
- Allen wavey
- What Drives You?

Top
#313284 - 02/26/07 09:27 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: AllenAyres]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
There you go, from the first post here, your last 2 lines should look like these 3 lines:

$body = <<<PPPRINT
$featured
PPPRINT;
_________________________
- Allen wavey
- What Drives You?

Top
#313285 - 02/26/07 09:32 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: AllenAyres]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
I think that would solve stan's problem from the last page as well. You've got

$body = blah

blah;

in there twice toward the bottom, it's gotta be once. You can do it like this:

$body = <<<EOF
$featured
EOF;

But either way should work, just make sure you don't have it in there twice.
_________________________
- Allen wavey
- What Drives You?

Top
#313286 - 02/26/07 09:41 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: AllenAyres]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
Mine are working again: http://www.praisecafe.org/forum/ubbthreads.php/ubb/cfrm

If you follow my instructions toward the bottom of page 1 here it works well. Your custom island should only have this in it:

Php Code:

/* PHP CODE HERE */
include('/yourpathto/gallery/inc_features2.php');

/* BODY HERE */
$body = <<<EOF
$photopostfeature
EOF;
 


Be sure and update your path to the inc_features2.php file.
_________________________
- Allen wavey
- What Drives You?

Top
#313294 - 02/26/07 08:51 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: AllenAyres]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 135
Loc: New Mexico
Originally Posted By: AllenAyres
There you go, from the first post here, your last 2 lines should look like these 3 lines:

$body = <<<PPPRINT
$featured
PPPRINT;


That did it! Its working for me now! Except when I choose the "random" case it seems I have a lot of thumbnails missing, or well, thats minor - at least its working.

Thank you thank you thank you!

Basil
_________________________

Top
#313340 - 03/03/07 03:31 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: Basil Fawlty]
Cuervo Offline
User

Registered: 11/10/01
Posts: 29
Has anyone got this working with 7.1 and PP 5.62

I've got PP "intergated" with 7.1 and I tried to copy and past the text from the first post and got nothing. I read the post with the photopost.inc.php txt file attach.


Ok I did it Allen's way with the feature2.php and got it to display. But the thumbnails are all black. If you click on them it opens the photopost window with the fullsize image.

Also, Allen, how did you make so only registered users could see the photos? I think I found this option in PP.


Edited by Cuervo (03/03/07 06:18 AM)
Edit Reason: more info
_________________________
-Cuervo
zOMG and oNOES

Top
#313341 - 03/03/07 06:32 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: Cuervo]
Cuervo Offline
User

Registered: 11/10/01
Posts: 29
Well I have it all working with the exception of the thumbnails showing up black inside uBBthreads. I see one other user had that issue, does anyone know a fix?
_________________________
-Cuervo
zOMG and oNOES

Top
#313344 - 03/03/07 09:57 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: Cuervo]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 135
Loc: New Mexico
Originally Posted By: Cuervo
Has anyone got this working with 7.1 and PP 5.62


I have it working with 7.1 and PP 5.62 (integrated). I will try to provide as must information as possible. First, I am using Imagemagik instead of GD in my PP. I don't know if that makes any difference, but thought I'd mention it. Ok, here is exactly, in total, what I have in my Custom PAL (I've just changed some minor things for security reasons, but you will want to put your paths and database names in anyway):

Php Code:

/* PHP CODE HERE */
// This script should pull 5 random pictures from
// PhotoPost and display it.
// Please modify the two lines with the databse
// connection to your settings.
//
// The base idea for this script comes from Chuck S. */

// Set it up to your path settings !
require_once("/home/mysite/public_html/forums/photopost/inc_photopost.php");

// Set this to your PhotoPost db prefix. Default is pp_
$pp_db_prefix = "pp_";

function pp_get_ext( $filename ) {
return substr($filename, strrpos($filename,"."));
}

function pp_is_image( $filename ) {
$retval = 0;

$mediatypes = array( ".jpg", ".gif", ".png", ".bmp" );
$ext = pp_get_ext( $filename );

if ( in_array(strtolower($ext), $mediatypes) )
$retval = 1;

return( $retval );
}

//
// Featured Photos Code
// Follow down to End Feature Photos Code
//

// which type of images do you want to show
$q_switch = "lastest";

switch ($q_switch) {
case "most_view":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY c.views DESC";
break;
case "lastest":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY date DESC";
break;
case "random":
$query = "SELECT p.id,p.user,p.userid,p.cat,p.title,p.bigimage,p.views
FROM {$pp_db_prefix}photos p
LEFT JOIN {$pp_db_prefix}categories c ON c.id=p.cat
WHERE c.password = ''
ORDER BY RAND()";
break;
}
$result = mysql_query($query);

$counted = 0; $featured = "";

while ( list($pid, $puser, $puserid, $pcat, $ptitle, $photo, $pviews) = mysql_fetch_array($result)) {
if ( pp_is_image($photo) ) {
$photolen = strlen($photo);
$theext = pp_get_ext($photo);
$photo_name = str_replace( $theext, "", $photo );

$temp_user = $line['userid'];
$thumbtag = "{$full_path}{$pcat}/thumbs/{$photo}";
$mthumb = "<img border=\"0\" src=\"{$data_dir}{$pcat}/thumbs/{$photo}\" alt=\"$thumbtag\" />";

// One box for each feature
$featured .= <<<PPPRINT

<tr align="center"><td align="center" class="alt-1">
<a href="{$url_path}/showphoto.php?photo={$pid}">$mthumb</a><br>
by {$puser}
</td></tr>

PPPRINT;

$counted++;
}

if ( $counted == 5 ) break;
}
mysql_free_result($result);

// change the dbname to your ubb7 database name
// we need to switch back to Threads7 database
//MAKE SURE TO USE YOUR CORRECT THREADS 7.1 DB NAME!
mysql_select_db ("threads")or die("Could not select database");

$body = <<<PPPRINT
$featured
PPPRINT;
  


Notice that I am pointing to inc_photopost.php in the "Require_Once" statement above. This is a file that now comes with PP 5.62.

Within the file inc_photopost.php you will want to uncomment the database lines near the top of the file like this:

Php Code:

$link = mysql_connect ("localhost", "usernam", "password") or die('I cannot connect to the database.');
mysql_select_db ("photopost")or die("Could not select photopost database");
  


Be sure to edit to reflect YOUR user name and password for the PP database. Also, make sure the "photopost" database name is what you are using in the mysql_select_db statement.

Not also, you can change this line:

// which type of images do you want to show
$q_switch = "lastest"; (Yes, I know it is mispelled)

you can replace "lastest" with "random" or "most_view" depending on what category of images you want to pull from the PP database.

I hope this helps. It works fine for me,

Basil




_________________________

Top
#313346 - 03/03/07 10:16 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: Basil Fawlty]
Cuervo Offline
User

Registered: 11/10/01
Posts: 29
Basil,

Thanks for getting back to this post so soon!

Well, I am using GD2 so I too am not sure if that matters. I did get it working finally.

I used Allen's post from page one. I would post my inc_features2.php but it has a copyright in it and I don't want to get in any trouble on this forum for posting it. But, if you follow Allen's post to the letter you will get it working. The is one small difference on my install. Since my PP is integrated with my ubbt I didn't have to set any of the parameters for my database. So I DIDN'T uncomment any lines of code.

My issue with the black thumbnails was fixed by adding a trailing / to the data path in my photopost config. This is located on the "edit integration" page of the admin section. The field is URL to your PhotoPost DATA directory and for me to get the thumbnails to work I had to edit the field to this

Code:
http://forums.yourdomain.com/photopost/data/

So it all works now! Thanks for the help!


Edited by Cuervo (03/03/07 10:35 AM)
_________________________
-Cuervo
zOMG and oNOES

Top
#313347 - 03/03/07 10:42 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: Cuervo]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 135
Loc: New Mexico
Glad you got it working. I'm not sure what the difference is in using the inc_features2 file versus the inc_photopost.php like I did, but mine works fine also.

Cheers,
Basil
_________________________

Top
#313348 - 03/03/07 10:47 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: Basil Fawlty]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
The inc.features2.php is just photopost's current code for this mod, so I use it rather than trying to re-create the wheel smile

paths and url's are critical for either mod to get working, always right click on the thumbs to see where it's trying to pull the images from if your thumbnails aren't showing up. smile
_________________________
- Allen wavey
- What Drives You?

Top
#313349 - 03/03/07 10:54 AM Re: Beta [7.0] PhotoPost featured photos pal [Re: AllenAyres]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 135
Loc: New Mexico
Does the "features2.php" files just get placed in the includes dor of PP then you point to THAT instead of the inc_photopost.php like I'm doing? (and where do I get this features2.php file?)

Basil


Edited by Basil Fawlty (03/03/07 10:56 AM)
_________________________

Top
#313350 - 03/03/07 12:04 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: Basil Fawlty]
Cuervo Offline
User

Registered: 11/10/01
Posts: 29
The inc_features2.php is something Allen modded from the inc_features.php that comes with PP and is located in the /photopost dir.

I'm sure how yours or this one works, but it seems to work well. The only other thing I would like to see is the "more photos" link in at the bottom of the photos. It lets people do a refresh on the photos.
_________________________
-Cuervo
zOMG and oNOES

Top
#313351 - 03/03/07 01:07 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: AllenAyres]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 135
Loc: New Mexico
Originally Posted By: AllenAyres
The inc.features2.php is just photopost's current code for this mod, so I use it rather than trying to re-create the wheel smile

paths and url's are critical for either mod to get working, always right click on the thumbs to see where it's trying to pull the images from if your thumbnails aren't showing up. smile


ALlen, I tried going it your way with the modified inc_features2.php file, using the directions you provided, but now I don't see any pictures at all. I'm not getting any errors either, so I'm pretty sure I'm connecting to the DB ok? The portal shows up ok, but no pictures (thumbs) are in it.

Basil
_________________________

Top
#313352 - 03/03/07 01:48 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: Basil Fawlty]
Cuervo Offline
User

Registered: 11/10/01
Posts: 29
Check your PMs Basil.

And can anyone suggest a way so that when you click on the thumbnail image it will open the larger one in its own window instead of loading over the forums?
_________________________
-Cuervo
zOMG and oNOES

Top
#313353 - 03/03/07 01:59 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: Cuervo]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 135
Loc: New Mexico
Saw you PM and replied - I have exactly the same code in my portal as you (except the path to inc_features2.php is different of course) Plus I have the exact same code as you do in inc)features2.php file (and my PP is integrated with Threads 7.1 like yours is). Yet, when I do it that way, all I get is th ePortal Title and a small blank box with NO thumbs. frown
_________________________

Top
#313354 - 03/03/07 02:14 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: Basil Fawlty]
Cuervo Offline
User

Registered: 11/10/01
Posts: 29
Strange, I can't think of anything else I did to get it working other then that bad path to my thumbnails. But, you had it working with the other methode so that should not be an issue for you.

Let me look at my stuff again. You are calling the $photopostfeature from inside the portal, yes? I'm sure you are, I just can't think of anything else.
_________________________
-Cuervo
zOMG and oNOES

Top
#313355 - 03/03/07 02:21 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: Cuervo]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 135
Loc: New Mexico
Yeah, its really strange, if I just plug the raw code into my PAL box it works, but it I try to do it like you did, with Allen's inc_features2.php file, all I get is the header in my Pal with a very small white area in the pal box.
_________________________

Top
#313356 - 03/03/07 03:25 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: Basil Fawlty]
Cuervo Offline
User

Registered: 11/10/01
Posts: 29
hum, borrowing from Allen's debug questions... can you right-click anything in that small white area to see where it is trying to link to? If so, maybe it will tell you something about the path it is trying to reach.
_________________________
-Cuervo
zOMG and oNOES

Top
#313357 - 03/03/07 03:45 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: Cuervo]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 135
Loc: New Mexico
Nope, there is nothing at all in the blank box
_________________________

Top
#313364 - 03/04/07 08:42 AM Re: [7.0] [Beta] PhotoPost featured photos pal [Re: Zarzal]
Cuervo Offline
User

Registered: 11/10/01
Posts: 29
Well I'm onto something else with this mod. I was trying to figure out how to add the more photos link that reloads the random photo when you click it.

So far, which isn't much I have figured out this.

It appears that this code located in the showphoto.php file

Code:
$prevajax = "&laquo; <a title=\"{$Globals['pp_lang']['morephotos']}\" href=\"javascript:sendPhotoReq('$npid','$cat','$photo','$limit','$sortby','$sortdir','$sorttime','$ppuser');\">{$Globals['pp_lang']['more']}</a> &middot;";
        }


and this
Code:
$nextajax = "&middot; <a title=\"{$Globals['pp_lang']['morephotos']}\" href=\"javascript:sendPhotoReq('$npid','$cat','$photo','$limit','$sortby','$sortdir','$sorttime','$ppuser');\">{$Globals['pp_lang']['more']}</a> &raquo;";
        }


are the parts that handle the more photos commands but where this would get plug into the inc_feature2.php and if that would work are beyond me.

Anyone have anyideas on this?
_________________________
-Cuervo
zOMG and oNOES

Top
#313434 - 03/08/07 01:49 AM Re: [7.0] [Beta] PhotoPost featured photos pal [Re: Cuervo]
ADWOFF Offline
Content Queen

Registered: 05/07/01
Posts: 709
Loc: Pennsylvania
I have a couple questions about Photopost smile

  1. Is this the program to use if you want to create an online photo album for your site?
  2. Can you control the size of the graphics uploaded and/or
  3. Default them to a specific size if they are too big?


---

I don't know if the last one makes sense or not!

We have book-signing events & get-togethers that we like to share our pictures with ... and often times, I get images that are in their original big-ass size--like 1.5 mb or something like that.

I obviously resize them, and go from there.

I would prefer to let them upload their own images--but, again, I need some kind of control over the size.

Thanks for any feedback!

_________________________
Sue
adwoff.com

Top
#313435 - 03/08/07 01:59 AM Re: [7.0] [Beta] PhotoPost featured photos pal [Re: ADWOFF]
Cuervo Offline
User

Registered: 11/10/01
Posts: 29
Hey,

http://www.photopost.com/featuresphp.html

All the features are listed on this page but to answer you questions.

1. Yes
2. Yes
3. No - it will resize them to a pixel x pixel size but I don't think it has the ability to compress phtoto/uploads to specific byte size. However, you can reject photos based on a byte size.
_________________________
-Cuervo
zOMG and oNOES

Top
#314934 - 07/24/07 12:54 PM Re: [7.0] [Beta] PhotoPost featured photos pal [Re: Cuervo]
Zarzal Offline
Coder

Registered: 07/03/01
Posts: 811
Loc: Berlin, Germany
I changed today to Allens suggestions. After a serverupgrade my version stop working and break the the whole portal cache system. Allens version works well if you carefully fill out your settings.
Thanks for this version.
_________________________
my forum: http://www.dragon-clan.de
my hobby: http://www.biker-reise.de

Top
#314972 - 07/26/07 10:45 AM Re: [7.0] [Beta] PhotoPost featured photos pal [Re: Zarzal]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
I'm glad it works for you smile
_________________________
- Allen wavey
- What Drives You?

Top
#315789 - 09/23/07 10:53 PM Re: Beta [7.0] PhotoPost featured photos pal [Re: Basil Fawlty]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
Anyone tried this with 6.0 yet?
_________________________
- Allen wavey
- What Drives You?

Top
Page 1 of 3 1 2 3 >



Moderator:  sirdude 
Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks